#creat a peewee model with name AStock
import peewee

import os

import peewee

current_dir = os.path.dirname(os.path.realpath(__file__))
# print(current_dir)
db = peewee.SqliteDatabase(current_dir+'/users.db')
class BaseModel(peewee.Model):
    class Meta:
        database = db

class UserProfile(BaseModel):
    id = peewee.AutoField()
    username = peewee.CharField(max_length=255)
    password = peewee.CharField(max_length=255)
    ip=peewee.CharField(max_length=255)


class UserProfileDal():
    #find all AStockModel in database
    def findAll(self):
        return UserProfile.select()

    def findByUsername(self,username):
        return UserProfile.select().where(UserProfile.username == username).get()
